from django.urls import path

from apps.users.views import UserNameCountView, RegisterView, SmsCodeView, MobileView, LoginView, LogoutView, CenterView

urlpatterns = [
    # 判断用户名是否重复
    # 正常情况下django有5种类型的转换器,那么我想自定义一个自己的转换器呢,如何实现.
    # 例如如果我有一个手机号,我在定义转换器的时候,必须写成<string:mobile> string类型是django自带类型
    # 但是我想把string类型变成我自己的<mobile:mobile> mobile类型应该如何实现呢.这样更好的表示了数据

    # http://www.mfy.site:8000/usernames/lzjmfy/count/
    path('usernames/<username:username>/count/',UserNameCountView.as_view(), name='username-count'),

    path("register/",RegisterView.as_view(), name="register"),

    # http://www.mfy.site:8000/mobiles/18743173982/count/
    path("mobiles/<mobile:mobiles>/count/",MobileView.as_view(), name="mobile-count"),

    # http://www.mfy.site:8000/sms_codes/18743173982/?image_code=RVKN&image_code_id=78e4e863-415a-4e63-9421-a721246ff1b1
    path("sms_codes/<mobile:mobiles>/",SmsCodeView.as_view(), name="sms_code"),

    # http://www.mfy.site:8000/login/
    path("login/",LoginView.as_view(), name="login"),

    # http://www.mfy.site:8000/logout/
    path("logout/",LogoutView.as_view(), name="logout"),

    path("center/",CenterView.as_view(), name="center"),
]